#include "factory.h"

#include "scroll/view.h"
#include "book/view.h"

#include <memory>

namespace QnigaUI
{
QnigaUI::I* Factory::CreateUI (Config::Core::UIType _uiType)
{
    std::auto_ptr<QnigaUI::Base> resUI;

    switch (_uiType)
    {
        case Config::Core::UI_BOOKVIEW:
            resUI.reset(new QnigaUI::Book::View());
            break;

        case Config::Core::UI_SCROLLVIEW:
            resUI.reset(new QnigaUI::Scroll::View());
            break;

        default:
            throw 0;
    }

    resUI->Setup();
    return resUI.release();
}
}
